package com.huang.array;

import java.util.Scanner;

/**
 * 目标：
 * 完成评委打分案例
 */
public class Demo6_Array {
    public static void main(String[] args) {
        //定义一个动态数组用于后面存储6个评委的打分
        double[] scores = new double[6];
        Scanner sc = new Scanner(System.in);
        //遍历数组，将评委的分数存储到数组
        for (int i = 0; i < scores.length; i++) {
            System.out.println("请输入第" + ( i + 1 ) + "个评委的打分：");
            double score = sc.nextDouble();
            scores[i] = score;
        }
        //定义变量用于求和
        double sum = 0;
        //遍历数组求和
        for (int i = 0; i < scores.length; i++) {
            sum = sum + scores[i];
        }
        //求平均分
        sum = sum / scores.length;
        System.out.println("最终分数为：" + sum);
    }
}